﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ClusterAggregation.DataSets
{
    using Datum;
    /**
     * Class Representation of a cluster.
     */
    public class CCluster
    {
        /** 
         * data is a list of data that is contained in this cluster in the form of a list. 
         * note that it's public to save in performance.
         */
        public List<AData> _data;
        /** 
        * more intuitive access to _data via getter.
        */
        public List<AData> data
        {
            get
            {
                return _data;
            }
        } // no setter

        /** simple constructor */
        public CCluster()
        {
            _data = new List<AData>();
        }

        /** Similarity comparator to other cluster (by Jaccard criterion) */
        public double compareTo(CCluster b)
        {
            // by Jaccard
            return (double)_data.Intersect(b.data).Count() / (double)_data.Union(b.data).Count();
        }
    } // end of class cluster
}
